'use strict';

let {
	codeShell, createPrivileges, random, JSONcopy,
	loader, loadImage, loadScript, generateImage,
	EventEmitter, Scene, Child,
	Vector2, vec2, VectorN, vecN,
	CameraImitationCanvas, CanvasLayer
} = globalThis.Ver;

let cvs = document.querySelector('.canvas');
let { main, back } = cvs.cameraImitationCanvas;

let touches = new TouchesController(cvs, e => e.path[0].className === 'gui');

let db = {}; // resures: [images, audios]
let cfg = {};


loadScript('ns_objects/global_ns.js');
loadScript('ns_objects/process_ns.js');
loadScript('ns_objects/term_ns.js');
loadScript('ns_objects/value_ns.js');
loadScript('ns_objects/nodes_ns.js');
// loadScript('ns_objects/panels_ns.js');
// loadSc2zript('ns_objects/gui_ns.js');

loadScript('scenes/test_env.js');


//========== LoopGame ==========//
(() => {
	let prevTime = 0;
	function _update(dt) {
		if(dt-prevTime < 100) Scene.update(dt-prevTime);
		prevTime = dt;
		touches.nullify();
		requestAnimationFrame(_update);
	};
	requestAnimationFrame(_update);
})();
